﻿using System.Text;

namespace ObjectTest
{
    class Person
    {
        string name;
        int? age;

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        public int? Age
        {
            get
            {
                return age;
            }
            set
            {
                age = value;
            }
        }

        public Person()
        :this(null, null)
        { 
        }

        public Person(string name)
        :this(name, null)
        { 
        }

        public Person(string name, int? age)
        {
            this.name = name;
            this.age = age;
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("Name: " + name + "\n");
            if (age != null)
            {
                sb.Append("Age: " + age);
            }
            else
            {
                sb.Append("Age not specified");
            }
            return sb.ToString();
        }
    }
}